﻿import QtQuick 2.15
import QtQuick.Controls 2.15


Item {

    Rectangle{
        id:settingPageBackRect
        anchors.fill: parent

        Component.onCompleted: {
            changeUserInfoLoader.source = "ChangeUserInfo.qml"
            changePortLoader.source = "ChangePort.qml"

        }

        Loader{
            id: changeUserInfoLoader
            anchors.fill: parent
            z: 2
        }


        Loader{
            id: changePortLoader
            anchors.fill: parent
            z: 2
        }

        Rectangle{
            id: header
            width: parent.width
            height: width/10
            anchors.top: parent.top
            color: "#404142"
            z: 10

            Rectangle{
                width: parent.width/4
                height: parent.height
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                opacity: 0
                MouseArea{
                    anchors.fill: parent
                    property point clickPos:"0,0"
                    onPressed:{
                    clickPos =Qt.point(mouseX, mouseY)
                    }
                    onPositionChanged:{
                    //鼠标偏移量
                    var delta =Qt.point(mouseX-clickPos.x, mouseY-clickPos.y)
                    rootWindow.setX(rootWindow.x+delta.x)
                    rootWindow.setY(rootWindow.y+delta.y)
                    }
                }
            }

            Text {
                id: settingTitle
                color: "#ffffff"
                text: qsTr("设置")
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                horizontalAlignment: Text.AlignHCenter
                verticalAlignment: Text.AlignVCenter
                font.family: kuaikanshijietiFont.font.family
                font.styleName: "Bold"
                font.pointSize: 14

            }

            Button {
                id: settingBackButton
                width: parent.height/2
                height: width
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                icon.source: "qrc:/img/reback.png"
                anchors.leftMargin: width

                onClicked: {
                    pageStackView.pop()
                    console.log("FirstPage.qml is loading...")
                }

            }
        }

        Rectangle{
            id: settingRectList
            width: parent.width
            height: parent.height - header.height
            anchors.top: header.bottom
            color: "#ffffff"
            z: 1

            Flickable {
                anchors.fill: parent
                contentWidth: width
                contentHeight: setListColumn.height
                boundsBehavior: Flickable.DragOverBounds
                flickableDirection: Flickable.VerticalFlick


                Column{
                    id: setListColumn
                    width: parent.width
                    spacing: 5

                    Component.onCompleted:{
                        const component = Qt.createComponent("SetRectBarComponent.qml")
                        component.createObject(setListColumn);
                        const portSetComponent = Qt.createComponent("PortSetComponent.qml")
                        portSetComponent.createObject(setListColumn);


                    }
                }

            }



        }

    }

}
